﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO_HealthInsurance;
using BLL_HealthInsurance;
using DTO_HealthInsurance;

namespace HealthInsuranceMgm.Admin
{
    public partial class MemberChangepass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            txtusername.Text = Session["username"].ToString(); 
        }
        public void message(string script)
        {

            Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", script, true);
        }
        protected void btnchange_Click(object sender, EventArgs e)
        {

            DAOSecurityPassword seccu = new DAOSecurityPassword();
            BLLEmployee bll = new BLLEmployee();
            DTOEmployee dto = new DTOEmployee();
            if (txtoldpass.Text.Equals(Session["password"].ToString()))
            {

                dto.EmpPassword = seccu.EnCrypt(txtnewpass.Text).ToString();
                dto.EmpUserName = Session["username"].ToString();
                bll.EMpchangepass(dto);
                message("alert('Change Password Successfull');");
            }
            else
            {
                message(" alert('Old password not Match!');");
            }
        }
    }
}